package com.zhonghui.procurement.service.Impl;

import java.util.List;
import com.zhonghui.common.utils.DateUtils;
import com.zhonghui.procurement.domain.ProcurementEvaluationTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhonghui.procurement.mapper.AssessmentMapper;
import com.zhonghui.procurement.domain.Assessment;
import com.zhonghui.procurement.service.IAssessmentService;

/**
 * 我的测评Service业务层处理
 *
 * @author zhonghui
 * @date 2023-12-10
 */
@Service
public class AssessmentServiceImpl implements IAssessmentService
{
    @Autowired
    private AssessmentMapper assessmentMapper;

    /**
     * 查询我的测评
     *
     * @param id 我的测评主键
     * @return 我的测评
     */
    @Override
    public Assessment selectAssessmentById(Long id)
    {
        return assessmentMapper.selectAssessmentById(id);
    }

    /**
     * 查询我的测评列表
     *
     * @param assessment 我的测评
     * @return 我的测评
     */
    @Override
    public List<Assessment> selectAssessmentList(Assessment assessment)
    {
        return assessmentMapper.selectAssessmentList(assessment);
    }

    /**
     * 新增我的测评
     *
     * @param assessment 我的测评
     * @return 结果
     */
    @Override
    public int insertAssessment(Assessment assessment)
    {
        assessment.setCreateTime(DateUtils.getNowDate());
        assessment.setUpdataTime(DateUtils.getNowDate());
        assessment.setState("0");
        return assessmentMapper.insertAssessment(assessment);
    }

    /**
     * 修改我的测评
     *
     * @param assessment 我的测评
     * @return 结果
     */
    @Override
    public int updateAssessment(Assessment assessment)
    {
        assessment.setUpdataTime(DateUtils.getNowDate());
        return assessmentMapper.updateAssessment(assessment);
    }

    /**
     * 批量删除我的测评
     *
     * @param ids 需要删除的我的测评主键
     * @return 结果
     */
    @Override
    public int deleteAssessmentByIds(Long[] ids)
    {
        return assessmentMapper.deleteAssessmentByIds(ids);
    }

    /**
     * 删除我的测评信息
     *
     * @param id 我的测评主键
     * @return 结果
     */
    @Override
    public int deleteAssessmentById(Long id)
    {
        return assessmentMapper.deleteAssessmentById(id);
    }

    /**
     * 查询测评任务
     *
     * @param id 测评任务主键
     * @return 测评任务
     */
    @Override
    public ProcurementEvaluationTask selectEvaluationTaskById(Long id)
    {
        return assessmentMapper.selectEvaluationTaskById(id);
    }
}
